package com.gusha.model;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name="train_comm")
@NamedQuery(name="TrainComm.findAll", query="SELECT t FROM TrainComm t")
@DynamicInsert
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TrainComm implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY) 
	private BigInteger id;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="user_id")
	private User user;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="train_id")
	private SysTraining sysTraining;
	
	@Column(name="comm_content")
	private String commContent;
	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="comm_time")
	private Date  trainTime;
	
	@Column(name="is_delete")
	private BigInteger isDelete;
	
	@Column(name="is_check")
	private BigInteger isCheck;
	
	@Column(name="state")
	private String state;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@NotFound(action=NotFoundAction.IGNORE)
	@JoinColumn(name="parents_id")
    private TrainComm parentsId;
    
    

	public TrainComm getParentsId() {
		return parentsId;
	}

	public void setParentsId(TrainComm parentsId) {
		this.parentsId = parentsId;
	}

	public BigInteger getId() {
		return id;
	}

	public void setId(BigInteger id) {
		this.id = id;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public SysTraining getSysTraining() {
		return sysTraining;
	}

	public void setSysTraining(SysTraining sysTraining) {
		this.sysTraining = sysTraining;
	}


	public String getCommContent() {
		return commContent;
	}

	public void setCommContent(String commContent) {
		this.commContent = commContent;
	}

	public Date getTrainTime() {
		return trainTime;
	}

	public void setTrainTime(Date trainTime) {
		this.trainTime = trainTime;
	}

	public BigInteger getIsDelete() {
		return isDelete;
	}

	public void setIsDelete(BigInteger isDelete) {
		this.isDelete = isDelete;
	}

	public BigInteger getIsCheck() {
		return isCheck;
	}

	public void setIsCheck(BigInteger isCheck) {
		this.isCheck = isCheck;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
	
}
